<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>

    <script>
        var y = prompt("请输入月份:");
        var r = prompt("请输入日期:");
    
        function xingzuo(y,r) {
            if(y>12||r>31){
               alert("日期不对");
            }else if (y == 3 && 21 <= r <= 31 || y == 4 && 1 <= r <= 20) {
                alert("白羊座");
            } else if (y == 4 && 21 <= r <= 30 || y == 5 && 1 <= r <= 21) {
                alert("金牛座");
            } else if (y == 5 && 22 <= r <= 31 || y == 6 && 1 <= r <= 21) {
                alert("双子座");
            } else if (y == 6 && 22 <= r <= 30 || y == 7 && 1 <= r <= 22) {
                alert("巨蟹座");
            } else if (y == 7 && 23 <= r <= 31 || y == 8 && 1 <= r <= 22) {
                alert("狮子座");
            } else if (y == 8 && 23 <= r <= 31 || y == 9 && 1 <= r <= 23) {
                alert("处女座");
            } else if (y == 9 && 24 <= r <= 30 || y == 10 && 1 <= r <= 23) {
                alert("天秤座");
            } else if (y == 10 && 24 <= r <= 31 || y == 11 && 1 <= r <= 22) {
                alert("天蝎座");
            } else if (y == 11 && 23 <= r <= 30 || y == 12 && 1 <= r <= 21) {
                alert("射手座");
            } else if (y == 12 && 22 <= r <= 31 || y == 1 && 1 <= r <= 20) {
                alert("摩羯座");
            } else if (y == 1 && 21 <= r <= 31 || y == 2 && 1 <= r <= 19) {
                alert("水瓶座");
            } else if (y == 2 && 20 <= r <= 28 || y == 3 && 1 <= r <= 20) {
                alert("双鱼座");
            }
        }
        xingzuo(y,r);
    </script>
</body>

</html>